<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>{$pagetitle}</title>
        <meta name="renderer" content="webkit" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <link rel="stylesheet" href="/static/admin/layuiadmin/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="/static/admin/css/admin_global.css" />
        <link rel="stylesheet" href="/static/admin/plugin/select2/css/select2.min.css" />
        <link rel="stylesheet" href="/static/admin/plugin/fancybox/jquery.fancybox-1.3.4.vot.css" />
        <link rel="stylesheet" href="/static/admin/plugin/jsmind-master/style/jsmind.css" />
        <style> table{ table-layout: fixed; } td,th { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } </style>
    </head>
    <body>
        <div class="layui-fluid padding-top-20">
            <div class="layui-card">
                <div class="layui-form-header">
                    <div class="header-left" id="header-left"><span class="layui-btn iframe " data-href="{:url('add',['member__id'=> $v.member__id])}" data-title="会员-新增" data-msg="确认操作吗？" data-height="100%" data-width="100%">新增</span></div>
                    <div class="header-right">
                        <form action="{:url()}" method="get" class="layui-form-pane" id="header-right">
                            <div class="layui-inline">
                                <label class="layui-form-label">创建时间</label>
                                <div style="display: flex;" class="layui-input-inline">
                                    <input type="text" name="member__create_time_start" id="member__create_time_start" autocomplete="false" class="layui-input form-date" readonly placeholder="开始创建时间" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" value="{:input('member__create_time_start')}" />
                                    <input type="text" name="member__create_time_end" id="member__create_time_end" autocomplete="false" class="layui-input form-date" readonly placeholder="结束创建时间" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" value="{:input('member__create_time_end')}" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">ID</label>
                                <div class="layui-input-inline">
                                    <input type="text" style="width:100px" name="member__id" autocomplete="false" class="layui-input" placeholder="" value="{:input('member__id')}" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">手机</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="member__phone" id="member__name" autocomplete="false" class="layui-input" placeholder="" value="{:input('member__phone')}" />
                                </div>
                            </div>                            
                            <div class="layui-inline">
                                <label class="layui-form-label">昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="member__name" id="member__name" autocomplete="false" class="layui-input" placeholder="" value="{:input('member__name')}" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button type="submit" class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search"> <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> </button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="component-form-element" action="{:url()}" method="post" onsubmit="return save_form(this);">
                        <table class="layui-table" lay-filter="table1">
                            <thead>
                                <tr id="table-header">
                                    <th style="width: 50px;">编号</th>
                                    <th>创建时间</th>
                                    <th>昵称</th>
                                    <th>状态</th>
                                    <th>手机号</th>
                                    <th>积分</th>
                                    <th>剩余对话</th>
                                    <th>注册方式</th>
<!--                                    <th>头像</th>-->
                                    <th style="width: 280px">操作</th>
                                </tr>
                            </thead>
                            <tbody id="table-body">
                                {foreach $data as $v}
                                <tr>
                                    <td title="{$v.member__id}">{$v.member__id}</td>
                                    <td title="{$v.member__create_time}">{$v.member__create_time}</td>
                                    <td title="{$v.member__name}"><a href="{:url('view',['id'=>$v.member__id])}" style="color: green" data-title="会员（{$v.member__name}）详情" class="iframe" data-height="100%" data-width="100%">{$v.member__name}</a></td>
                                    <td>{if $v.status}
                                        <a class="layui-badge layui-bg-green ajax_del" title="点击禁用" data-msg="确定要禁用这个用户吗，禁用后将无法登录使用" href="{:url('set_status',['id'=>$v.member__id,'status'=>0])}">启用</a>
                                        {else/}<a class="layui-badge layui-bg-danger ajax_del" title="点击开启" data-msg="确定要开启这个用户吗？" href="{:url('set_status',['id'=>$v.member__id,'status'=>1])}">禁用</a>{/if}
                                    </td>
                                    <td title="{$v.member__phone}">{$v.member__phone}</td>
                                    <td title="{$v.member__point_num}">{$v.member__point_num}</td>
                                    <td title="{$v.member__point_num}">
                                        {if $v.member__chat_end_time}
                                            {$v.member__chat_end_time|date="Y/m/d"}
                                        {else /}
                                            {$v.member__number_of_free_chats}
                                        {/if}
                                    </td>
                                    <td title="{$v.member__point_num}">{$v.member__is_mobile_registration?'小程序':'电脑端'}</td>
<!--                                    <td>-->
<!--                                        {if $v.member__avatar}-->
<!--                                        <a class="fancybox" href="{$v.member__avatar}">-->
<!--                                            <img src="{$v.member__avatar}" draggable="false" style="max-width: 100px; max-height: 50px;object-fit:cover;" />-->
<!--                                        </a>-->
<!--                                        {else/} - {/if}-->
<!--                                    </td>-->
                                    <td>
<span class="layui-btn layui-btn-sm" onclick="vlogin({$v.member__id})" >模拟登录</span>

<span class="layui-btn layui-btn-sm iframe " data-href="{:url('recharge',['id'=> $v.member__id])}" data-title="会员（{$v.member__name}）积分调整" data-msg="确认操作吗？" data-height="100%" data-width="100%">积分调整</span>

</td>
                                </tr>
                                {/foreach}
                            </tbody>
                        </table>
                        <div class="layui-inline" id="table-footer"></div>
                    </form>
                    <div class="layui-box layui-laypage layui-laypage-default" id="table-paginate">{$paginate|raw}</div>
                </div>
            </div>
        </div>
        <script src="/static/admin/layuiadmin/layui/layui.js"></script>
        <script src="/static/js/jquery-3.6.2.min.js"></script>
        <script src="/static/admin/plugin/select2/js/select2.full.min.js"></script>
        <script src="/static/js/crypto-js.min.js"></script>
        <script src="/static/admin/js/global.js"></script>
        <script src="/static/admin/plugin/fancybox/jquery.easing-1.3.pack.js"></script>
        <script src="/static/admin/plugin/fancybox/jquery.fancybox-1.3.4.vot.js"></script>
        <script src="/static/admin/plugin/shengshiqu/distpicker.data.js"></script>
        <script src="/static/admin/plugin/shengshiqu/distpicker.js"></script>
        <script src="/static/admin/js/openfile.js"></script>
        <script src="/static//admin/js/check.js"></script>
        <script src="/static/admin/plugin/jsmind-master/js/jsmind.js"></script>
        <!--文件上传 start-->
        <script src="/static/admin/plugin/webuploader/kinderfile.js"></script>
        <script src="/static/admin/plugin/webuploader/Sortable.js"></script>
        <script src="/static/admin/plugin/webuploader/morepic.js"></script>
        <!--以下是针对 快速上传单个文件插件-->
        <link rel="stylesheet" href="/static/admin/plugin/webuploader/style/webuploader.css" />
        <link rel="stylesheet" href="/static/admin/plugin/webuploader/style/style.css" />
        <script src="/static/admin/plugin/webuploader/webuploader.min.js"></script>
        <script src="/static/admin/plugin/webuploader/fastupimg.js"></script>
        <script>
  function playVideoSrc(src) {
    if(src){
      $.fancybox({
        content:'<div class="fancybox_video_play"><video  style="width:100%;height:600px" id="fancybox_video_src" src="'+src+'" autoplay controls></video></div>',
      })
    }else{
      layer.msg("视频地址为空");
    }
  }
</script>
        <script>

  $(document).ready(function() {
    $("a.fancybox").fancybox();
    $('.select2').select2();
  })

  layui.laydate.render({
    elem: '.form-date'
  })

</script>
        <script id="js1"></script>
        <script>
  function exportTable(){
    // 使用outerHTML属性获取整个table元素的HTML代码（包括<table>标签），然后包装成一个完整的HTML文档，设置charset为urf-8以防止中文乱码
    var html = "<html><head><meta charset='utf-8' /></head><body>" + document.getElementsByTagName("table")[0].outerHTML + "</body></html>";
    // 实例化一个Blob对象，其构造函数的第一个参数是包含文件内容的数组，第二个参数是包含文件类型属性的对象
    var blob = new Blob([html], { type: "application/vnd.ms-excel" });
    var a = document.getElementById("download_a");
    // 利用URL.createObjectURL()方法为a元素生成blob URL
    a.href = URL.createObjectURL(blob);
    // 设置文件名
    a.download = "{$exportName}.xls";
    a.click()
  }


  // 模拟登录
  function vlogin(id) {
      $.get('/admin/member/vlogin?id=' + id, function(res){
          window.open(res);
      })
  }
</script>
    </body>
</html>
